from homework08.FP_grow_tree import FP_Grow_tree
import pandas as pd
import time
# 对数据进行预处理
data = pd.read_excel('data.xls', skiprows=[0], index_col=0)
goods_name = pd.Series(data.columns)
record = []
for row in data.as_matrix():
    # print(goods_name[row=='T'].as_matrix().tolist())
    record.append(goods_name[row == 'T'].as_matrix().tolist())
starttime=time.time()
ff = FP_Grow_tree.FP_Grow_tree(record, [], 200)
endtime=time.time()
# 只比较挖掘频繁模式基的速度
print("程序运行的时间是{}s".format(endtime - starttime))
ff.printfrequent()

